home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / jam / jamdisk7 / inc9110b.lzh / include / getopt.h < prev    next >
C/C++ Source or Header  |  1991-04-25  |  2KB  |  38 lines

  1. /*
  2.  * getopt.h
  3.  * for Amiga/GCC/PDC Simon Wright (sjwright@cix) 25.4.91
  4.  */
  5.  
  6. #ifndef __GETOPT_H__
  7. #define __GETOPT_H__
  8.  
  9. /*
  10.  * may return an alpha (the option encountered), in which case global output
  11.  * variables are valid, '?', in which case an error of some sort has occurred,
  12.  * or EOF, when argv[optind] is the first actual argument.
  13.  *
  14.  * optstring governs the option processing.  It contains letters, ':', or ';'.
  15.  * The letters indicate legal options.  A letter not followed by ':' or ';'
  16.  * takes no arguments and may appear in a string of options (-abcd). A letter
  17.  * followed by ':' indicates that the option takes a mandatory argument, which
  18.  * may optionally be white-space-separated; the option must be the last of a 
  19.  * string of options.  A ';' indicates that the option's argument may be qualified.
  20.  * If a qualifier is present it is returned in optqual.  '-a-foo' returns a
  21.  * qualifier '-', while '-a+foo' & '-a foo' return a qualifier of '+'.
  22.  * Options may be introduced by '-' (as usual) or '+'; whichever is used is
  23.  * returned in optsign.
  24.  */
  25.  
  26. int getopt(int argc, char **argv, char *optstring);
  27.  
  28.             /* global interface */
  29. extern int    opterr;        /* !0 if errors to be remarked on */
  30. extern int    optind;        /* on completion, argv[optind] is the first actual arg */
  31.             /* the following only valid if getopt() returned an alpha */
  32. extern int    optopt;        /* the option letter */
  33. extern char    optsign;    /* '-' or '+', introducer of option */
  34. extern char    optqual;    /* '-' or '+' (default), for ';' options */
  35. extern char    *optarg;        /* the argument, or NULL */
  36.  
  37. #endif /* __GETOPT_H__
  38.